﻿@model Wicresoft.SelfService.DAO.RKMModel
@{
    Layout = "~/Views/Shared/_KnowledgeLayout.cshtml";
}

<script type="text/javascript">
    $(function () {
        $("#btn_search").bind("click", function () {
            var kw = $("#kwords").val();
            var baseUrl = "@Html.Raw(Model.SearchBaseUrl)"; //need raw html string without html-encoding
            $("#kwords_redirectionUrl").val(baseUrl + kw);
            //window.open(baseUrl + kw);
        });
        $("#kwords").bind("keydown", function (event) {
            if (event.which == 13) {
                $("#btn_search").trigger('click');
                        }
//            var kw = $("#kwords").val();
//            var baseUrl = "@Html.Raw(Model.SearchBaseUrl)"; //need raw html string without html-encoding
//            $("#kwords_redirectionUrl").val(baseUrl + kw);
        });

        $("a.search_top_title").bind("click", function () {
            var url = $(this).attr("href");
            $("#link_redirectionUrl").val(url);
            document.linkform.submit();
            return false;
        });

    });
</script>

@*<div class="ChannelTitle"><h2>Search 搜索</h2></div>*@
                
                <div class="box_padding">
                    <div class="box_top ui-icons"></div>
                    <div class="box_bg"><div class="box_padding">
                    <div class="decoP">
                        <div class="box_bg_decoP_B">
                        <div class="border_line"> 
                        @using (Html.BeginForm("SSO", "Account", FormMethod.Post, new {  target ="_blank" }))
                        {
                            <table width="100%" border="0" cellpadding="0" cellspacing="0"><tbody>
                            <tr>
                                <td width="30%" class="tdName">搜索知识库</td><td width="50%" class="tdData">
                                <input class="InputStyle2" type="text" id="kwords" />
                                <input id="kwords_redirectionUrl" name="redirectionUrl" type="hidden" />
                                </td>
                                <td width="20%" class="tdData">
                               
                                    <input class="Button2 ui-icons" id="btn_search" title="搜索" value="" type="submit" />
                                </td>
                            </tr>
                            </tbody></table>
                        }
                            </div>
                        </div>
                    </div>
                    <div class="inputarea"><h3><i class="ui-icons"></i> 热门知识</h3>
                    @using (Html.BeginForm("SSO", "Account", FormMethod.Post, new { target = "_blank", name = "linkform", id = "linkform" }))
                    {
                       <input id="link_redirectionUrl" name="redirectionUrl" type="hidden" />
                    <div class="search_top">
                        <ul class="search_top_left">

                            @for (int i = 0; i < Model.RKMs.Take(10).Count(); i++)
                            {
                                if (i == 0)
                                {
                                    <li class="border_none"><i class="search_top_item1 ui-icons">1</i> 
                                    
                                    <a class="search_top_title" href="@Model.RKMs.ElementAt(i).BaseUrl" target="_blank">@Model.RKMs.ElementAt(i).ArticleTitle</a>
                                    <span style="font-style:italic"> [引用 @Model.RKMs.ElementAt(i).Times 次]</span>
                                    </li>
                                }
                                else if (i <= 2)
                                {
                                    <li class=""><i class="search_top_item1 ui-icons">@(i + 1)</i> 
                                    
                                    <a class="search_top_title" href="@Model.RKMs.ElementAt(i).BaseUrl" target="_blank">@Model.RKMs.ElementAt(i).ArticleTitle</a>
                                    <span style="font-style:italic"> [引用 @Model.RKMs.ElementAt(i).Times 次]</span>
                                    </li>
                                }
                                else if (i <= 9)
                                {
                                    <li class=""><i class="search_top_item2 ui-icons">@(i + 1)</i> 

                                    <a class="search_top_title" href="@Model.RKMs.ElementAt(i).BaseUrl" target="_blank">@Model.RKMs.ElementAt(i).ArticleTitle</a>
                                    <span style="font-style:italic"> [引用 @Model.RKMs.ElementAt(i).Times 次]</span>
                                    </li>
                                }
                            }
                        </ul>
                        <ul class="search_top_right">
                         @for (int i = 10; i < Model.RKMs.Skip(10).Take(10).Count(); i++)
                         {
                             if (i == 10)
                             {
                                    <li class="border_none"><i class="search_top_item1 ui-icons">@(i + 1)</i>

                                    <a class="search_top_title" href="@Model.RKMs.ElementAt(i).BaseUrl" target="_blank">@Model.RKMs.ElementAt(i).ArticleTitle</a>
                                    <span style="font-style:italic"> [引用 @Model.RKMs.ElementAt(i).Times 次]</span>
                                    </li>
                             }
                             else if (i <= 12)
                             {
                                    <li class=""><i class="search_top_item1 ui-icons">@(i + 1)</i> 
                                    
                                    <a class="search_top_title" href="@Model.RKMs.ElementAt(i).BaseUrl" target="_blank">@Model.RKMs.ElementAt(i).ArticleTitle</a>
                                    <span style="font-style:italic"> [引用 @Model.RKMs.ElementAt(i).Times 次]</span>
                                    </li>
                             }
                             else if (i <= 19)
                             {
                                    <li class=""><i class="search_top_item2 ui-icons">@(i + 1)</i> 
                                    <a class="search_top_title" href="@Model.RKMs.ElementAt(i).BaseUrl" target="_blank">@Model.RKMs.ElementAt(i).ArticleTitle</a>
                                    <span style="font-style:italic"> [引用 @Model.RKMs.ElementAt(i).Times 次]</span>
                                    </li>
                             }
                         }
                        </ul>
                    </div>
                    }
                    </div>
                    </div></div>
                
                    
                    <div class="box_down ui-icons"></div>
                </div>

